<template>
    <ul class="todo-list">
        <!-- 2.2 循环任务-关联选中状态-铺设数据 -->
        <!-- completed: 完成的类名 -->
        <li :class="{completed:obj.isDone}" v-for="(obj,index) in arr" :key="obj.id">
            <div class="view">
                <input class="toggle" type="checkbox" v-model="obj.isDone" />
                <label>{{obj.name}}</label>
                <button class="destroy" @click="delFn(index)"></button>
            </div>
        </li>
    </ul>
</template>
  
<script>
export default {
    props:["arr"],
    methods:{
        delFn(index){
            this.$emit("del",index)
        }
    }
}
</script>